package com.zsc.externalservice.mapper;

import com.zsc.externalservice.entity.AdsSjzlCcTbcProduct;
import com.zsc.externalservice.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CigaretteMapper {

    /**
     * 获取所有卷烟信息
     * @return
     */
    @Select("select product_name, direct_retail_price, whole_sale_price, sale_begin_date, price_type_code_text, " +
            "is_active, factory_simple_name, tar_qty, nicotine_qty, product_style_code_text, " +
            "package_qty, package_qty2, product_code from ADS_SJZL_CC_TBC_PRODUCT;")
    List<AdsSjzlCcTbcProduct> getAll();

    /**
     * 根据名称查询卷烟数据
     * @param name
     * @return
     */
    @Select("select product_name, direct_retail_price, product_code, package_qty, package_qty2 , retail_price, whole_sale_price from ADS_SJZL_CC_TBC_PRODUCT where product_name = #{name} limit 1")
    Product getCigaretteByName(String name);

    /**
     * 根据卷烟代码code查询信息
     * @param productCode
     * @return CigaretteVO
     */
    @Select("select * from ADS_SJZL_CC_TBC_PRODUCT where product_code = #{productCode}")
    AdsSjzlCcTbcProduct getByCode(String productCode);

}
